#ifndef BASEFORM_H
#define BASEFORM_H

#include "ClientItem.h"
#include "ChatWidget.h"
#include "TcpManager.h"

#include <QWidget>
#include <QListWidget>
#include <QVBoxLayout>
#include <QLabel>
#include <QMap>

class BaseForm : public QWidget
{
    Q_OBJECT

public:
    BaseForm(QWidget *parent = nullptr);
    ~BaseForm();

    void init();
    void initSignalAndSlots();

private slots:
    void slot_NewClient(const NewClient &data);
    void slot_FilePacket(const FilePacket &data);
    void slot_MessagePacket(const MessagePacket &data);

private:
    QListWidget* m_ListWidget;
    QLabel* m_OnLineNum;
    TcpManager* m_TcpManager;

    QMap<QString,ClientItem*> m_ClientMap;
    QMap<QString,ChatWidget*> m_ChatWidgetMap;

    QString m_FilePath = QDir::homePath();
};
#endif // BASEFORM_H
